﻿using Abp.AutoMapper;
using Paas.Core.Documents.Entities;
using Basefr.App.Dtos;

namespace Paas.App.Interface.Documents.Dtos
{
    [AutoMap(typeof(Document))]
    public class DocumentDto : DtoBase
    {
        public string Name { get; set; }

        public string Code { get; set; }

        public long Size { get; set; }
        public string SizeStr => Size > 1024 * 1024
            ? (Size / (float)(1024 * 1024)).ToString("N2") + " MB"
            : (Size / (float)1024).ToString("N2") + " KB";

        public long UploaderId { get; set; }
        public string UploaderName { get; set; }


        public string DownloadUrl => $"/Download/Document?id={Id}&code={Code}";
    }
}

